Post

Replies

Boosts

Views

Activity

Is it possible to add multiple haptics to play one after another in Swift?
I've been trying to add multiple haptic events based on when each view I have animates in, however when testing it only plays the first haptic and stops there. I've tried searching online if it's even possible to play multiple haptics in a short space of time (would the Taptic Engine be ready to fire off multiple times that quickly?) but couldn't find anything. Anyone know if this is even possible and if so why mine might not be working? I've tried 2 different methods of adding multiple haptics in: Here's my code for the first method, where I'm initialising a new instance first and then playing the same haptic within each animation block with a 0.25 delay between animations: } Here's the 2nd method I've tried, where I initialise and play a new haptic within each animation block: } So far both methods only play the first haptic and stop right there. Any ideas if this works? Thanks.
2
0
2k
Mar ’21
How to schedule local notifications at slightly different times everyday in Swift?
I have this code that currently schedules a local notification to be fired a set amount of time before an event (e.g: 30 mins before golden hour begins). It works fine the first day and schedules the notification exactly 30 mins before the event time, however the next day, since golden hour has now changed by 2 mins due to sunset times, the notification is still being scheduled 30 mins before the time of the day before. For example, if golden hour is at 17:52 today, notification is set for 30 mins before and therefore will correctly fire at 17:22. Tomorrow, golden hour is now 17:54, but the notification will still fire at 17:22, not 17:24. As you can see, after a week or 2, the notification times will be completely off. This is my function that schedules a local notification, setting repeats in the trigger to true: (I've added ... where extra code not relevant to the question is, just to make it easier to understand what's going on) } And I call this function when the user hits on a button to select how many hours/mins before the golden hour times they would like to be notified: scheduleNotificationBefore(hour: 0, min: 30) Is this the correct way to go about solving my issue? Am I missing something? Any help would be very useful. I'm happy to explain each line of code further, just ask!
2
0
1.3k
Mar ’21
UIDatePicker does not reflect chosen tintColor in iOS 15?
I have a UIDatePicker which I previously set it's tintColor to .systemOrange inside IB and this worked fine prior to iOS 15. For some reason with the release of 15, my datePicker's tintColor is still .systemOrange when I print it out at runtime but it shows as a default colour (that is white in dark mode and black in light mode) until selected, when it then switches to my selected colour. Then, after selecting a date and the view collapses back in, it automatically switches back to that 'default' colour again. This issue only popped up with iOS 15. I would like it to always be my chosen tintColor at all times please, not only when selected! I currently set my tintColor in IB, but I've already tried setting it programmatically and as User Defined Runtime Attributes, both of which with no luck. Any ideas what's going and anyone else have the same issue?
1
0
885
Oct ’21